<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>gohttp server</title>
    <link rel="shortcut icon" type="image/png" href="/-/res/favicon.png" />
    <link rel="stylesheet" type="text/css" href="/-/res/bootstrap-3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/-/res/font-awesome-4.6.3/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="/-/res/css/github-markdown.css">
    <link rel="stylesheet" type="text/css" href="/-/res/css/dropzone.css">
    <link rel="stylesheet" type="text/css" href="/-/res/css/style.css">
    <link rel="stylesheet" type="text/css" href="/-/res/themes/[[.Theme]].css">
</head>

<body id="app">
    <nav class="navbar navbar-default">
        <div class="container">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-2">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="/">[[.Title]]</a>
                </div>
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
                    <ul class="nav navbar-nav">
                        <!-- <li><a href="{{.dir}}">{{.dir}}</a></li> -->
                    </ul>
                    <form class="navbar-form navbar-right">
                        <div class="input-group">
                            <input type="text" name="search" class="form-control" placeholder="Search text" v-bind:value="search" autofocus>
                            <span class="input-group-btn">
                                <button class="btn btn-default" type="button">   
                                <span class="glyphicon glyphicon-search"></span>
                            </button>
                            </span>
                        </div>
                    </form>
                    <ul id="nav-right-bar" class="nav navbar-nav navbar-right">
                    </ul>
                </div>
            </div>
        </div>
    </nav>
    <div class="container">
        <div class="col-md-12">
            <ol class="breadcrumb">
                <li>
                    <a v-on:click='changePath("/", $event)' href="/"><i class="fa fa-home"></i></a>
                </li>
                <li v-for="bc in breadcrumb.slice(0, breadcrumb.length-1)">
                    <a v-on:click='changePath(bc.path, $event)' href="{{bc.path}}">{{bc.name}}</a>
                </li>
                <li v-if="breadcrumb.length >= 1">
                    {{breadcrumb.slice(-1)[0].name}}
                </li>
            </ol>
            <table class="table table-hover">
                <thead>
                    <tr>
                        <td colspan=4>
                            <button class="btn btn-xs btn-default" v-on:click='toggleHidden()'>
                                Show hidden <i class="fa" v-bind:class='showHidden ? "fa-eye" : "fa-eye-slash"'></i>
                            </button>
                            <button class="btn btn-xs btn-default" v-if="auth.upload" data-toggle="modal" data-target="#upload-modal">
                                Upload file <i class="fa fa-upload"></i>
                            </button>
                        </td>
                    </tr>
                    <tr>
                        <th>Name</th>
                        <th>Size</th>
                        <th class="hidden-xs">
                            <span style="cursor: pointer" v-on:click='mtimeTypeFromNow = !mtimeTypeFromNow'>ModTime</span>
                        </th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="f in computedFiles">
                        <td>
                            <a v-on:click='clickFileOrDir(f, $event)' href="/{{f.path}}">
                                <i style="padding-right: 0.5em" class="fa" v-bind:class='genFileClass(f)'></i> {{f.name}}
                            </a>
                        </td>
                        <td>{{f.size}}</td>
                        <td class="hidden-xs">{{formatTime(f.mtime)}}</td>
                        <td style="text-align: left">
                            <template v-if="f.type == 'dir'">
                                <a class="btn btn-default btn-xs" href="/-/zip/{{f.path}}">
                                    <span class="hidden-xs">Archive</span> Zip
                                    <span class="glyphicon glyphicon-download-alt"></span>
                                </a>
                            </template>
                            <template v-if="f.type == 'file'">
                                <a class="btn btn-default btn-xs hidden-xs" href="/{{f.path}}?download=true">
                                    <span class="hidden-xs">Download</span>
                                    <span class="glyphicon glyphicon-download-alt"></span>
                                </a>
                                <a class="btn btn-default btn-xs hidden-xs" v-on:click="genQrcode(f.name)" href="javascript:void(0)">
                                    <span v-if="shouldHaveQrcode(f.name)">QRCode</span>
                                    <span class="glyphicon glyphicon-qrcode"></span>
                                </a>
                                <a class="btn btn-default btn-xs visible-xs" v-if="shouldHaveQrcode(f.name)" href="{{genInstallURL(f.name)}}">
                                    Install
                                </a>
                            </template>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="col-md-12" id="preview" v-if="previewFile">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title" style="font-weight: normal">
                        <i class="fa" v-bind:class='genFileClass(previewFile)'></i>
                        {{previewFile.name}}
                    </h3>
                </div>
                <div class="panel-body">
                    <article class="markdown-body">{{{previewFile.contentHTML }}}
                    </article>
                </div>
            </div>
        </div>
        <div class="col-md-12" id="content">
            <!-- Small qrcode modal -->
            <div id="qrcode-modal" class="modal fade" tabindex="-1" role="dialog">
                <div class="modal-dialog modal-sm">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title">
                                <span id="qrcode-title"></span>
                                <a style="font-size: 0.6em" href="#" id="qrcode-link">[view]</a>
                            </h4>
                        </div>
                        <div class="modal-body">
                            <div id="qrcodeCanvas"></div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- Upload modal-->
            <div id="upload-modal" class="modal fade" tabindex="-1" role="dialog">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title">
                                <i class="fa fa-upload"></i> File upload
                            </h4>
                        </div>
                        <div class="modal-body">
                            <form action="#" class="dropzone" id="my-dropzone"></form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <div id="footer" class="pull-right" style="margin: 2em 1em">
                <a href="https://github.com/codeskyblue/gohttpserver">gohttpserver (ver:{{version}})</a>, written by <a href="https://github.com/codeskyblue">codeskyblue</a>. 2016. go1.6
            </div>
        </div>
    </div>
    <script src="/-/res/js/jquery-3.1.0.min.js"></script>
    <script src="/-/res/js/jquery.qrcode.js"></script>
    <script src="/-/res/js/qrcode.js"></script>
    <script src="/-/res/js/vue-1.0.min.js"></script>
    <script src="/-/res/js/showdown-1.4.2.min.js"></script>
    <script src="/-/res/js/moment.min.js"></script>
    <script src="/-/res/js/dropzone.js"></script>
    <script src="/-/res/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="/-/res/js/index.js"></script>
    [[if .GoogleTrackerId ]]
    <script>
    (function(i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function() {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date();
        a = s.createElement(o),
            m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

    ga('create', '[[.GoogleTrackerId]]', 'auto');
    ga('send', 'pageview');
    </script>
    [[ end ]]
</body>

</html>
